package com.king.core.practices.day01;

/**
 * 描述: 斐波那契数列
 *
 * @author : sujinchen
 * @date : 2020/11/2
 */
public class Demo5 {
    public int show(int n) {
        int a = 1;
        int b = 1;
        if (n == 2) {
            return a + b;
        }
        for (int i = 2; i < n; i++) {
            a = a + b;
            b = a - b;

        }
        return a;
    }

    public static void main(String[] args) {
        Demo5 demo5 = new Demo5();
        System.out.println(demo5.show(8));

    }
}
